﻿using IMES.Common.Domain.SirModel;
using IMES.Common.Dtos;
using IMES.Common.Infrastructure;
using MediatR;

namespace GlennQuigmire.API.Application.Commands
{
    public class OutboundOrderTypeSearchHander : IRequestHandler<OutboundOrderTypeSearchCommand, ResultT<OutboundOrderType>>
    {

        private readonly IBaseRepositorys<OutboundOrderType> baseRepositorys;
        public OutboundOrderTypeSearchHander(IBaseRepositorys<OutboundOrderType> baseRepositorys)
        {
            this.baseRepositorys = baseRepositorys;
        }

        /// <summary>
        /// 获取出库单类型列表（下拉框数据）
        /// </summary>
        /// <param name="request">获取出库单类型列表请求对象</param>
        /// <param name="cancellationToken">允许异步取消 cancellationToken</param>
        /// <returns></returns>
        public Task<ResultT<OutboundOrderType>> Handle(OutboundOrderTypeSearchCommand request, CancellationToken cancellationToken)
        {
            var result = new ResultT<OutboundOrderType>();

            var list = baseRepositorys.GetAll().ToList();
            result.Data = list;
            return Task.FromResult(result);

        }
    }
}
